package team.you.change.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import team.you.change.pojo.Notice;
import team.you.change.util.Result;
import team.you.change.service.NoticeService;

import javax.annotation.Resource;

@Controller
@RequestMapping("/notice")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;

    @RequestMapping("/getAllNotices")
    @ResponseBody
    private Result getAllNotices(Integer page, Integer limit)
    {
        return noticeService.getAllNotices(page,limit);
    }
    @RequestMapping("/del")
    @ResponseBody
    private Result del(String id)
    {
        return noticeService.del(id);
    }
    @RequestMapping("/delete")
    @ResponseBody
    private Result delete(String[] ids)
    {
        return noticeService.delete(ids);
    }
    @RequestMapping("/update")
    @ResponseBody
    private Result update(String id,String value,String field)
    {
        return noticeService.update(id,value,field);
    }
    @RequestMapping("/add")
    @ResponseBody
    private Result add(Notice notice){
        return noticeService.add(notice);
    }
    @RequestMapping("/getTop")
    @ResponseBody
    private Result getTop(){
        return noticeService.getTop();
    }
    @RequestMapping("/getPage")
    @ResponseBody
    private Result getPage(){
        return noticeService.getPage();
    }
}
